Revising the Select Query 2 hackerrank solution